package modeladesktop.gui;
import java.util.*;
import javax.swing.table.*;

public class ModeloCoeficiente extends AbstractTableModel{
	private static final String cabeceras[] = {"Variable", "Coeficiente", "Error", "T", "P", "VIF"};
	public Object vars [] = null;
	public Object data[][] = null;

	public ModeloCoeficiente(Object [] vars, Object data[][]){
		System.out.println("vars "+ vars.length);
		System.out.println(" rows "+data.length);
		System.out.println(" cols "+data[0].length);
		this.vars = vars;
		this.data = data;
		fireTableRowsInserted(0, data.length);
	}

	@Override
	public int getRowCount(){
		return vars.length;
	}

	@Override
	public int getColumnCount(){
		return 6;
	}

	@Override
	public String getColumnName(int col){
		return cabeceras[col];
	}

	@Override
	public Object getValueAt(int row, int col){
		if(col == 0)
			return vars[row];
		return data[row][col-1];
	}

	@Override
	public void setValueAt(Object valor, int row, int col){
		if(col > 0){
			if(valor == null){
				data[row][col-1] = null;
			}else
				data[row][col-1] = valor;
		}
	}
}
